package com.yt.project.controller;

import com.yt.project.common.BaseResponse;
import com.yt.project.common.ResultUtils;
import com.yt.project.model.entity.User;
import com.yt.project.model.vo.UpInfoVO;
import com.yt.project.service.UpInfoService;
import com.yt.project.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/up/info/")
public class UpInfoController {

    @Resource
    private UpInfoService upInfoService;

    @Resource
    private UserService userService;

    @GetMapping("/match")
    public BaseResponse<List<UpInfoVO>> matchUps(HttpServletRequest request) {
        User loginUser = userService.getLoginUser(request);
        List<UpInfoVO> upInfoVOS = upInfoService.matchUps(loginUser, 10);
        return ResultUtils.success(upInfoVOS);
    }
}
